/*大文件传输测试*/
/*给服务器上传一个较大的文件*/

/*dd if=/dev/zero of=./hello.txt bs=100M count=4*/ 
/*创建一个 bs * count大小的，名字为of后的一个文件*/

/*然后用ms5sum指令，对文件进行编码 -> 如果一样就说明写成功了！*/

#include "../HttpServer.hpp"

int main(){
    Socket cli_sock;
    cli_sock.CreateClient(8080, "127.0.0.1");
    std::string req = "PUT /1234.txt HTTP/1.1\r\nConnection: keep-alive\r\n";
    std::string body;
    Util::ReadFromFile("./hello.txt", &body);

    req += "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n";
    assert(cli_sock.Send((char*)req.c_str(), req.size()) != -1);
    assert(cli_sock.Send((char*)body.c_str(), body.size()) != -1);
    char buf[1024] = {0};
    assert(cli_sock.Recv(buf, 1023));
    LOG(LogLevel::DEBUG) << buf;
    sleep(3);
    cli_sock.Close();
    return 0;
}